create table Menu
(
	 [MenuId] int identity(1, 1) primary key
	,[RestaurantId] int
	,[MenuTypeId] int
	,[Viands] varchar(128)
	,[MenuName] nvarchar(128)
	,[SortDescription] nvarchar(256)
	,[DetailDescription] nvarchar(max)
	,[Price] decimal
	,[CreatedBy] int
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
	,[Status] int
)
go

ALTER PROCEDURE MenuGet
	@MenuId int
AS
SELECT*
FROM [Menu]
WHERE [Menu].[MenuId] = @MenuId
GO

ALTER PROCEDURE MenuList
AS
SELECT *
FROM [Menu]
ORDER BY MenuId DESC
GO

ALTER PROCEDURE MenuInsert
	@RestaurantId int
	,@MenuTypeId int
	,@Viands varchar(128)
	,@MenuName nvarchar(128)
	,@SortDescription nvarchar(256)
	,@DetailDescription nvarchar(max)
	,@Price decimal
	,@CreatedBy int
	,@CreatedDate datetime
	,@UpdatedBy int
	,@UpdatedDate datetime
	,@Status int
AS

INSERT INTO Menu (
	 [RestaurantId]
	,[MenuTypeId]
	,[Viands]
	,[MenuName]
	,[SortDescription]
	,[DetailDescription]
	,[Price]
	,[CreatedBy]
	,[CreatedDate]
	,[UpdatedBy]
	,[UpdatedDate]
	,[Status]
	
) VALUES (
	 @RestaurantId
	,@MenuTypeId
	,@Viands
	,@MenuName
	,@SortDescription
	,@DetailDescription
	,@Price
	,@CreatedBy
	,@CreatedDate
	,@UpdatedBy
	,@UpdatedDate
	,@Status
	
)

select SCOPE_IDENTITY()
GO

ALTER PROCEDURE MenuUpdate
	@MenuId int, 
	@RestaurantId int, 
	@MenuTypeId int, 
	@Viands varchar(128), 
	@MenuName nvarchar(128), 
	@SortDescription nvarchar(256), 
	@DetailDescription nvarchar(max), 
	@Price decimal,
	@CreatedBy int, 
	@CreatedDate datetime, 
	@UpdatedBy int, 
	@UpdatedDate datetime, 
	@Status int 

AS

UPDATE Menu SET
	   [RestaurantId] = @RestaurantId
	   ,[MenuTypeId] = @MenuTypeId
	   ,[Viands] = @Viands
	   ,[MenuName] = @MenuName
	   ,[SortDescription] = @SortDescription
	   ,[DetailDescription] = @DetailDescription
	   ,[Price] = @Price
	   ,[CreatedBy] = @CreatedBy
	   ,[CreatedDate] = @CreatedDate
	   ,[UpdatedBy] = @UpdatedBy
	   ,[UpdatedDate] = @UpdatedDate
	   ,[Status] = @Status
WHERE [Menu].[MenuId] = @MenuId
GO

ALTER PROCEDURE MenuDelete
	@MenuId int
AS
DELETE FROM Menu
WHERE [Menu].[MenuId] = @MenuId
GO
